CiderRunMode = {};CiderRunMode.runmode = true;CiderRunMode.assertImage = true;require "CiderDebugger";-----------------------------------------------------------------------------------------
--
-- main.lua
--
-----------------------------------------------------------------------------------------
--Debug the smart way with Cider!
--start coding and press the debug button


display.setStatusBar(display.HiddenStatusBar)

local lime = require("lime")
local map = lime.loadMap("background.tmx")
require("physics")
physics.start()

local onPlayerSpawnObject = function(object)
    local layer = map:getTileLayer("player")
    player = display.newImage(layer.group, "player.png")
    player.x = object.x
    player.y = object.y
end
map:addObjectListener("PlayerSpawn", onPlayerSpawnObject)

local visual = lime.createVisual(map)

local physical = lime.buildPhysical(map)

physics.addBody(player, { density = 1.0, friction = 0.3, bounce = 0.2 })


local onTouch = function(event)
    player:applyLinearImpulse(0,-5,player.x,player.y)
end

Runtime:addEventListener( "touch", onTouch )

--local layer = map:getTileLayer("player")
--if(layer) then
--    local tiles = layer.tiles
--    for i=1, #tiles, 1 do
--        if(tiles[i].IsAnimated) then
--            local tile = tiles[i]
--            if(tile.animation1) then
--                tile.sprite:prepare("animation1")
--                tile.sprite:play()
--            end
--        end
--    end
--end

